package com.chance.cc.crawler.development.bootstrap.medicinal;

import com.chance.cc.crawler.core.CrawlerEnum;
import com.chance.cc.crawler.core.filter.FilterInfo;
import com.chance.cc.crawler.core.filter.FilterUtils;
import com.chance.cc.crawler.core.record.CrawlerRequestRecord;
import com.chance.cc.crawler.development.controller.DevCrawlerController;

/**
 * created by ljl 20210628
 * 医药网  行业动态板块
 */

public class MedicinalDongtai {

    public static void main(String[] args) {
        String domain = "medicinalDongtai";
        String site = "news";

        FilterInfo filterInfo = new FilterInfo();
        filterInfo.setFilter(CrawlerEnum.CrawlerRecordFilter.count);
        filterInfo.setCurCount(0);
        filterInfo.setCountTotalNum(2);

        CrawlerRequestRecord requestRecord = CrawlerRequestRecord.builder()
                .startPageRequest(domain, CrawlerEnum.CrawlerRequestType.turnPage)
                .domain(domain)
                .httpUrl("http://www.medicinal.cn/html/dongtai/")
                .recordKey("http://www.medicinal.cn/html/dongtai/")
                .releaseTime(System.currentTimeMillis())
                .filter(CrawlerEnum.CrawlerRecordFilter.dateRange)
                .addFilterInfo(FilterUtils.dateRangeFilterInfo(24*7,null))
                .turnPageFilterInfo(filterInfo)
                .build();
        requestRecord.tagsCreator().bizTags().addDomain(domain);
        requestRecord.tagsCreator().bizTags().addSite(site);

        DevCrawlerController.builder()
                .triggerInfo(domain,domain,System.currentTimeMillis(),domain)
                .crawlerRequestQueue(DevCrawlerController.devRequestQueue(domain))
                .consoleResultPipeline() //控制台输出
                .fileResultPipeline("D:\\chance\\log\\tets.log",true) //文件输出
                .requestRecord(requestRecord)
                .build()
                .start();
    }
}
